package tsj.ai.alibaba.data.analysis.common.enums;

import java.util.Optional;

/**
 * @author taoshujian
 * @version 1.0
 * @since 2025-11-14 11:45:17
 */
public enum DatabaseDialectEnum {
    MYSQL("MySQL"),

    SQLite("SQLite"),

    POSTGRESQL("PostgreSQL"),

    H2("H2");

    public final String code;

    DatabaseDialectEnum(String code) {
        this.code = code;
    }

    public String getCode() {
        return code;
    }

    public static Optional<DatabaseDialectEnum> getByCode(String code) {
        for (DatabaseDialectEnum value : values()) {
            if (value.code.equals(code)) {
                return Optional.of(value);
            }
        }
        return Optional.empty();
    }
}
